/*---------------------- modbus_tcp_ll.h ----------------------*/
#ifndef __MODBUS_TCP_LL_H
#define __MODBUS_TCP_LL_H

#include "stm32f1xx_ll_usart.h"
#include "stm32f1xx_ll_bus.h"
#include "stm32f1xx_ll_gpio.h"
#include <stdint.h>
#include <freertos.h>
// ????
//#define MB_TCP_SLAVE_ID        0xFF    // ????
#define MB_HOLDING_REG_NUM     3000    // ???????
#define MB_TCP_RX_BUF_SIZE     3000     // ???????

// ??????
extern float dc_v[13];
extern float dc_i[13];
extern float v_k[13];
extern float i_k[13];
extern float i_k_a[13];
extern uint16_t rtu_buff[1090];
//extern uint16_t holding_regs[MB_HOLDING_REG_NUM];
extern uint8_t ModebusRxBuff[128];
//extern uint8_t mb_rx_buffer[MB_TCP_RX_BUF_SIZE];
extern uint8_t rx_usart1_cnt;
//extern volatile uint16_t mb_rx_index;
extern uint16_t modbue_SlaveAddr;
extern uint8_t rtu;
extern uint8_t proto;
// ????
//void MB_TCP_Init(void);
void MB_TCP_Process(void);
void MB_SendException(uint8_t func, uint8_t excode);

#endif